package cn.deschen.search.constants;

import com.github.shyiko.mysql.binlog.event.EventType;

/**
 * @Author hanbin_chen
 * @Description 数据库的操作类型
 * @DateTime 2021/6/8
 * @Version V1.0.0
 */
public enum OpType {

    ADD,
    UPDATE,
    DELETE,
    OTHER;

    public static OpType to(EventType eventType) {

        switch (eventType) {
            case EXT_WRITE_ROWS:
                return ADD;
            case EXT_UPDATE_ROWS:
                return UPDATE;
            case EXT_DELETE_ROWS:
                return DELETE;
            default:
                return OTHER;
        }
    }
}
